compare Object text in two module

Hello Forum,

I am trying to compare the object text in two module, if this match then I want to print the absolute no. from the first module , I get the first 6 Absolute no. and then my script get an infinite loop .

did anyone know why?

 

my code

pragma runLim, 0
string modulName1 = "/firstmodul/"
string modulName2 = "/secondmodul/"

Module f = read(modulName1)
Module m = read(modulName2)
Object o 
Object p

showDeletedObjects(true)

filtering off

for o in m do {
string Res = o."result"
string abs = o."Absolute Number"
string objtext1 = o."Object Text"
if (Res == "ok"){ 
for p in f do {
string objtext2 = p."Object Text"
if ((!isDeleted (p)) && !null (p) && objtext1 == objtext2 ){
string abs1 = p."Absolute Number"
print  abs1 " have result" Res  "\n"
   }
  }
 } 
}

 

Best regards,

Neven


Control17 - Thu Nov 30 04:20:34 EST 2017

Re: compare Object text in two module
thsturm - Thu Nov 30 05:51:33 EST 2017

Does the first loop "for o in m do {" loop-for-ever or the second loop "for p in f do {"?

How do you know, your loop loops-for-ever and it is not only a big loop inside a big loop?

 

 

Re: compare Object text in two module
pommCannelle - Thu Nov 30 06:11:37 EST 2017

You may have a look on memory leak in the forum and should forget the idea to store the content of your module in a loop of loop ;D

My advice is to fill a skip list with object text as key and object as data for module m.
Then you do a loop on the module f, searching the corresponding "m object" using the skip list. (1 more loop)

Have fun !

 

Re: compare Object text in two module
Control17 - Thu Nov 30 08:59:14 EST 2017

pommCannelle - Thu Nov 30 06:11:37 EST 2017

You may have a look on memory leak in the forum and should forget the idea to store the content of your module in a loop of loop ;D

My advice is to fill a skip list with object text as key and object as data for module m.
Then you do a loop on the module f, searching the corresponding "m object" using the skip list. (1 more loop)

Have fun !

 

thank u for your reply , I need help Frown

 

I did it , I get im DXL output Abs no. but they are wrong  , did u know why ?

 

pragma runLim, 0
string modulName1 = "/firstmodul/"
string modulName2 = "/secondmodul/"

Module f = read(modulName1)
Module m = read(modulName2)
Object o 
Object p
showDeletedObjects(true)
filtering off

Skip objList = create()
for o in m do {
string Res = o."result"
string abs = o."Absolute Number"
string objtext1 = o."Object Text"
if (Res == "ok"){
put (objList,objtext1,o)
 }
}

for p in f do {
string abs1 = p."Absolute Number"
string objtext2 = p."Object Text"
if (find(objList,objtext2)){
print abs1 " have result ok "  "\n"
  }
 }

 

Best regards,

 

Re: compare Object text in two module
pommCannelle - Thu Nov 30 09:41:29 EST 2017

Control17 - Thu Nov 30 08:59:14 EST 2017

thank u for your reply , I need help Frown

 

I did it , I get im DXL output Abs no. but they are wrong  , did u know why ?

 

pragma runLim, 0
string modulName1 = "/firstmodul/"
string modulName2 = "/secondmodul/"

Module f = read(modulName1)
Module m = read(modulName2)
Object o 
Object p
showDeletedObjects(true)
filtering off

Skip objList = create()
for o in m do {
string Res = o."result"
string abs = o."Absolute Number"
string objtext1 = o."Object Text"
if (Res == "ok"){
put (objList,objtext1,o)
 }
}

for p in f do {
string abs1 = p."Absolute Number"
string objtext2 = p."Object Text"
if (find(objList,objtext2)){
print abs1 " have result ok "  "\n"
  }
 }

 

Best regards,

 

Skip objList = createString()
for o in m do {
    if ( o."result""" != "ok") continue
    put(objList, o."object text""", o)    
}

for p in f do {
    if( ! find(objList, p."object text""", o)) continue
    print p."absolute number" " has a result: " o."absolute number" "\n"
}
delete objList

Use createString instead of create for the skip ...
And do it simple ... i'm not sure that create variables in loop is a good idea with DXL ;)
No time to test it ... but this is the idea for the 2 loops.

 

Enjoy !

Re: compare Object text in two module
Control17 - Fri Dec 01 04:28:16 EST 2017

pommCannelle - Thu Nov 30 09:41:29 EST 2017

Skip objList = createString()
for o in m do {
    if ( o."result""" != "ok") continue
    put(objList, o."object text""", o)    
}

for p in f do {
    if( ! find(objList, p."object text""", o)) continue
    print p."absolute number" " has a result: " o."absolute number" "\n"
}
delete objList

Use createString instead of create for the skip ...
And do it simple ... i'm not sure that create variables in loop is a good idea with DXL ;)
No time to test it ... but this is the idea for the 2 loops.

 

Enjoy !

thank u for your reply

 

Regards,